package com.yanmaohu.yulia.statement;

import com.yanmaohu.yulia.bean.BooleanValueExpression;
import com.yanmaohu.yulia.bean.DynamicCursorName;
import com.yanmaohu.yulia.bean.SetClauseList;
import com.yanmaohu.yulia.bean.TargetTable;

/**
 * @author Bright Lee
 */
public final class UpdateStatement implements SqlDataChangeStatement, Statement {

    private int beginIndex;
    private int endIndex;
    private TargetTable targetTable;
    private SetClauseList setClauseList;
    private BooleanValueExpression searchCondition;
    private DynamicCursorName dynamicCursorName;

    public UpdateStatement(int beginIndex, int endIndex, TargetTable targetTable, SetClauseList setClauseList) {
        this.beginIndex = beginIndex;
        this.endIndex = endIndex;
        this.targetTable = targetTable;
        this.setClauseList = setClauseList;
    }

    public UpdateStatement(int beginIndex, int endIndex, TargetTable targetTable, SetClauseList setClauseList, BooleanValueExpression searchCondition) {
        this.beginIndex = beginIndex;
        this.endIndex = endIndex;
        this.targetTable = targetTable;
        this.setClauseList = setClauseList;
        this.searchCondition = searchCondition;
    }

    public UpdateStatement(int beginIndex, int endIndex, TargetTable targetTable, SetClauseList setClauseList, DynamicCursorName dynamicCursorName) {
        this.beginIndex = beginIndex;
        this.endIndex = endIndex;
        this.targetTable = targetTable;
        this.setClauseList = setClauseList;
        this.dynamicCursorName = dynamicCursorName;
    }

    @Override
    public int getBeginIndex() {
        return beginIndex;
    }

    @Override
    public int getEndIndex() {
        return endIndex;
    }

    public TargetTable getTargetTable() {
        return targetTable;
    }

    public SetClauseList getSetClauseList() {
        return setClauseList;
    }

    public BooleanValueExpression getSearchCondition() {
        return searchCondition;
    }

    public DynamicCursorName getDynamicCursorName() {
        return dynamicCursorName;
    }

}
